import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;

public class problem59 {
    public static void main(String[] args) throws Exception {
        File file = new File("cipher1.txt");
        File file2 = new File("output.txt");
        if (file.exists()) {
            FileOutputStream fileOutputStream = new FileOutputStream(file2);
            FileInputStream fileInputStream = new FileInputStream(file);
            byte[] raw = new byte[fileInputStream.available()];
            fileInputStream.read(raw);
            String text = new String(raw).trim();

            if (text != null && text.length() > 0) {
                String[] strings = text.split(",");
                List<Integer> numbers = new ArrayList<Integer>();
                for(String string : strings) {
                    numbers.add(Integer.parseInt(string));
                }

                for(char a = 97; a < 123; a++) {
                    for(char b = 97; b < 123; b++) {
                        for(char c = 97; c < 123; c++) {
                            int counter = 0;
                            int[] array = new int[] {a, b, c};

                            StringBuilder stringBuilder = new StringBuilder();
                            for(int number : numbers) {
                                stringBuilder.append(String.valueOf(((char)(number ^ array[counter]))));
                                counter++;
                                if(counter % 3 == 0)
                                    counter = 0;
                            }
                            byte[] bytes = (stringBuilder.toString() + "\n").getBytes();
                            fileOutputStream.write(bytes);
                        }
                    }
                }
                fileOutputStream.flush();
                fileOutputStream.close();
            }
        } else {
            System.out.println("No File");
        }
    }
}
